package com.polito.mad.bikeponyapp.persistence;

public enum DeliveryItemState {

	WAITING_FOR_PICKUP(0),
	BEING_DELIVERED(1),
	DELIVERED(2);
	
	private final int state;
	private DeliveryItemState(int state) {
		this.state=state;
	}
	
	public int getState()
	{
		return this.state;
	}
	public static DeliveryItemState fromState(int state)
	{
		for(DeliveryItemState itemState: DeliveryItemState.values())
		{
			if(itemState.getState()==state)
				return itemState;
		}
		throw new IllegalArgumentException("no Delivery item State exists for the specified state");
	}
}
